package com.bite.product.api;

import com.bite.product.model.ProductInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
@Slf4j
public class ProductFallbackFactory implements FallbackFactory<ProductApi> {
    @Override
    public ProductApi create(Throwable cause) {
        return new ProductApi() {
            @Override
            public ProductInfo getProductInfo(Integer productId) {
                log.error("查询商品失败, productId:{}", productId);
                return new ProductInfo();
            }

            @Override
            public String p1(Integer id) {
                log.error("p1调用失败, id:{}", id);
                return null;
            }

            @Override
            public String p2(Integer id, String name) {
                log.error("p2调用失败, id:{}, name:{}", id, name);
                return null;
            }

            @Override
            public String p3(ProductInfo productInfo) {
                log.error("p3调用失败, productInfo:{}", productInfo);
                return null;
            }

            @Override
            public String p4(ProductInfo productInfo) {
                log.error("p4调用失败, productInfo:{}", productInfo);
                return null;
            }
        };
    }
}
